#pragma once

#include "ColorUtils/Color.h"
#include "RayTracer/Intersectable.h"
#include "RayTracer/Plain.h"

class FlatRectangle : public Intersectable
{
private:
	Color _color;

protected:
	Point _vec1, _vec2, _p0;
	Plain _plain;
	double _zOfNormal, _yOfNormal, _xOfNormal;

public:
	FlatRectangle(Point p0, Point p1, Point p2, const Color&);
	void WhereIntersects(const Ray&, FirstIntersectionResult&);
	void ColorAtIntersection(SecondIntersectionResult&, const Point&, const Ray&);
	Direction NormalAtPoint(FirstIntersectionResult&, const Point&);
	~FlatRectangle();
};

typedef boost::shared_ptr<FlatRectangle> FlatRectangle_ptr;